package com.cs.service;

import com.cs.code.RpcDecoder;
import com.cs.code.RpcEncoder;
import com.cs.config.ZookeeperConfig;
import com.cs.entity.RpcRequest;
import com.cs.handler.UserServerHandler;
import com.cs.serialize.JSONSerializer;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.string.StringEncoder;
import org.apache.curator.framework.CuratorFramework;
import org.apache.zookeeper.CreateMode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.PreDestroy;

@Service
public class UserServiceImpl implements UserService {

    @Value("${serName}")
    private String serName;


    public String sayHello(String word) {
        System.out.println("get consumer`s question："+word);
        System.out.println("我是服务："+serName);
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return serName+"回答:success";
    }

}
